package com.testjpa.web;

import com.alibaba.fastjson.JSON;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 作者: LCG
 * 日期: 2020/5/19 10:44
 * 描述:
 */
@RestController
public class RibbonController2 {

    @Value("${server.port}")
    private String port;

    @RequestMapping("test02")
    public String test02(@RequestBody Map<String,Object> map){

        //将参数打印出来模拟接收到参数
        System.out.println("=======client2==="+ JSON.toJSONString(map));

        if(map.get("id")!=null && map.get("id").toString().equals("1")){
            throw new RuntimeException("出错了222");
        }

        return port;

    }


    /**
     * 测试zuul的动态路由的功能
     * @return
     */
    @RequestMapping("test22")
    public String testZuul(){

        System.out.println("========这里是consul-client2服务=========");

        return port+"========这里是consul-client2服务=========";

    }

}
